package fr.cnam.projetSiw.client.core.mapper;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

import fr.cnam.projetSiw.client.core.ClientFactory;
import fr.cnam.projetSiw.client.structure.DescArtistPlace;
import fr.cnam.projetSiw.client.structure.DescEventPlace;
import fr.cnam.projetSiw.client.structure.HomePlace;
import fr.cnam.projetSiw.client.structure.pages.HomeActivity;
import fr.cnam.projetSiw.client.structure.pages.description.DescArtistActivity;
import fr.cnam.projetSiw.client.structure.pages.description.DescEventActivity;

public class MainContentMapper implements ActivityMapper {

	private ClientFactory clientFactory;
	
	public MainContentMapper(ClientFactory clientFactory) 
	{
		this.clientFactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if(place instanceof HomePlace)
		{
			return new HomeActivity(clientFactory);
		}
		if (place instanceof DescEventPlace)
		{
			return new DescEventActivity(clientFactory);
		}
		if (place instanceof DescArtistPlace)
		{
			return new DescArtistActivity(clientFactory);
		}
			
			
		return null;
	}

	public ClientFactory getClientFactory() {
		return clientFactory;
	}


}
